import { sqlMain } from '@utils/dbconf'
import { htmap } from '@maps/htmap'
import { success,error,SQL_ERROR } from '@utils/response'
// import { dateFormat } from '../utils/functions'
import { analysis } from '@utils/request'
import redisDB from '@utils/redisconf'
import fs from 'fs'  
import { toToken,tokenTo,changeToken } from '@utils/tokenOper'
import htindex from '@/staticdata/htindex.js'const { Random,mock } = require('mockjs')
export const piedata = async (req,res) =>{
  try{
    // const { id,data } = res.locals
    return res.send(success(htindex.piedata))
    // const { ctnum,hisctnum } = await redisDB.get(4,"num")
    // const allcpttnum = await sqlMain(htmap.allcpttnum,[id])
    // const hiscpttnum = await sqlMain(htmap.hiscpttnum,[id])
    // allcpttnum.forEach(e=>{
    //   e.itemStyle = {color:e.name? 'Lime':'OrangeRed'}
    //   e.name = '我的-' + e.name? '可用':'不可用'
    // })
    // allcpttnum.push({name:"其他人",value:ctnum,
    // itemStyle:{color:'#0003'}})
    // hiscpttnum.forEach(e=>{
    //   e.itemStyle = {color:e.name? 'Lime':'OrangeRed'}
    //   e.name = '我的-' + e.name? '可用':'不可用'
    // })
    // hiscpttnum.push({name:"其他人",value:hisctnum,
    // itemStyle:{color:'#0003'}})
    // return res.send(success({'未完结比赛':allcpttnum,'历史比赛':hiscpttnum}))
  }catch(e){
    console.log(e)
    return res.send(SQL_ERROR)}
}

export const linedata = async (req,res) => {
try{
  return res.send(success(htindex.linedata))
}catch(e){
  return res.send(SQL_ERROR)}
}

export const bardata = async (req,res) => {
try{
  return res.send(success(htindex.bardata))
}catch(e){
  return res.send(SQL_ERROR)}
}

export const tagdata = async (req,res) => {
try{
  return res.send(success(htindex.tagdata))
}catch(e){
  return res.send(SQL_ERROR)}
}